package com.ll.blog.model.query;

import com.ll.blog.contant.ArticleStatusEnum;
import com.ll.blog.contant.TypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.List;

@Data
@Validated
public class ArticleQuery extends PageQuery implements Serializable {
    @Max(value = 1,message = "状态为0或1")
    @Min(value = 0,message = "状态为0或1")
    @ApiModelProperty("状态")
    private Integer status =1;
    @ApiModelProperty("分类id")
    private Integer classId;

    @Data
    @Validated
    public static class updateArticleReq {

        @Min(value = 4, message = "文章标题长度不能小于4")
        @ApiModelProperty(value = "文章标题")
        private String title;

        @ApiModelProperty(value = "封面")
        private String cover;

        @ApiModelProperty(value = "文章内容")
        private String content;

        @ApiModelProperty(value = "字数")
        private String words;

        @ApiModelProperty(value = "标签")
        private List<Integer> tags;

        @ApiModelProperty(value = "预期阅读时间")
        private String readTime;

        @ApiModelProperty(value = "发布状态（0 未发布 1 已发布）默认为1")
        private Integer status;

        @ApiModelProperty(value = "简介")
        private String about;

        @ApiModelProperty(value = "分类id")
        private Integer categoryId ;

        @ApiModelProperty(value = "是否置顶")
        private Integer isTop;

    }

    @Data
    @Validated
    public static class addArticleReq {
        @NotEmpty(message = "文章标题不能为空")
        @Min(value = 4, message = "文章标题长度不能小于4")
        @ApiModelProperty(value = "文章标题")
        private String title;

        @ApiModelProperty(value = "封面")
        private String cover;
        @NotEmpty(message = "文章内容不能为空")
        @ApiModelProperty(value = "文章内容")
        private String content;

        @ApiModelProperty(value = "字数")
        private String words;

        @ApiModelProperty(value = "标签")
        private List<Integer> tags;

        @ApiModelProperty(value = "预期阅读时间")
        private String readTime;
        @ApiModelProperty(value = "发布状态（0 未发布 1 已发布）默认为1")
        private Integer status = 1;

        @ApiModelProperty(value = "简介")
        private String about;

        @ApiModelProperty(value = "分类id")
        private Integer categoryId =1;

    }

    @Validated
    public static class ContentReq {

        @ApiModelProperty(value = "评论状态（0 未审核 1通过 2 已删除）")
        private TypeEnum status;
    }
}
